//
//  HomeCell.m
//  植物管理
//
//  Created by liujianlong on 2022/11/21.
//

#import "HomeCell.h"
@interface HomeCell()
@property (strong, nonatomic) IBOutlet UIView *bgView;
@property (strong, nonatomic) IBOutlet UIImageView *img;
@property (strong, nonatomic) IBOutlet UILabel *title;
@property (strong, nonatomic) IBOutlet UILabel *num;
@property (strong, nonatomic) IBOutlet UILabel *subtitle;
@property (strong, nonatomic) IBOutlet UILabel *date;

@end
@implementation HomeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    CGFloat w = (SCREEN_WIDTH - 32);
    CGRect bounds = CGRectMake(0, 0, w, self.bgView.frame.size.height);
    self.bgView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)].CGPath;
    self.bgView.layer.shadowColor = @"#E8F1EC".color.CGColor;
    self.bgView.layer.shadowOffset = CGSizeMake(0, 0);
    self.bgView.layer.cornerRadius = 20;
    self.bgView.layer.shadowRadius = 10;
    self.bgView.layer.shadowOpacity = 1;}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}
- (void)setModel:(Job *)model{
    _model = model;
    self.img.image = model.imgs.count > 0 ? [UIImage imageWithData:model.imgs[0]] : nil;
    self.title.text = model.plant;
    self.num.text = [NSString stringWithFormat:LS(@"数量:%@颗"),model.num];
    self.subtitle.text = [NSString stringWithFormat:LS(@"记农事:%@"),LS(model.job)];
    self.date.text = [NSString stringWithFormat:LS(@"种植时间:%@"),[NSDate transToDate:@"yyyy-MM-dd" :model.stamp]];
}
@end
